CSS Quiz — Answers + Why

Each option shows whether it’s correct and a short reason.

Q1Which property is used to create space inside an element, between the content and the border?

Q2What is the purpose of calc() in CSS?

Q3What does CSS stand for?

Q4How do you add a comment in a CSS file?

Q5Which unit is relative to the root element’s font size?

Q6Which CSS property is used to prevent an element from overflowing its container?

Q7What is the correct syntax for importing a stylesheet in CSS?

Q8How do you add a background color for all <h1> elements?

Q9Which CSS property is used to make text bold?

Q10How do you make an element's text uppercase?

Q11What is the default value of box-sizing?

Q12Padding shorthand: 10px top, 15px bottom, 5px right, 10px left?

Q13How do you create a CSS animation that loops infinitely?

Q14How do you apply a CSS rule to all <p> elements inside a <div>?

Q15Which snippet centers a website horizontally?

Q16If you want flex items to wrap to the next line?

Q17Which is the correct CSS syntax?

Q18What does the z-index property control?

Q19How do you declare a CSS variable?

Q20Which CSS property allows an element to align itself within a flex container?